<?php
include_once "header.php";


if(isset($_POST["id"])){
	$kd_sm = $_POST["id"];
}

$cek_field="";

if (ISSET($_POST["tambah_tindaklanjut"])){

	if($_POST["tindaklanjut"]==""){
	$cek_field="Peringatan: Silahkan isikan seluruh data yang tersedia.";
	
	} else {
		$daftar_tindaklanjut = new Daftar_tindaklanjut();
		$tindaklanjut = new Tindaklanjut();
		$tindaklanjut->setKd_sm($_POST["id"]);
		$tindaklanjut->setPenindaklanjut($_SESSION['nip']);
		$tindaklanjut->setTindaklanjut($_POST["tindaklanjut"]);
		$tindaklanjut->setWaktu(date("Y-m-d H:i:s"));
		//var_dump($tindaklanjut);
		$daftar_tindaklanjut->add($tindaklanjut);
		header("Location:detil_sm.php?id=".$_POST["id"]."");
	}
}
?>

<div id="container">
	<div id="errorcont">
		<?php echo $cek_field;
		?>
	</div>
	<div id="maincont">
		<?php include_once "menu_samping.php"; ?>
		<div id="mainright">
			<div id="title">
			Surat Masuk > Detil > Rekam Tindaklanjut
			</div>
			<div id="body">
			</br>
			<form name="form1" method="POST" action="rekam_tindaklanjut.php">
			<input type="hidden" name="tambah_tindaklanjut">
			<input type="hidden" name="id" value="<?php echo $kd_sm; ?>">
			<table border=0 cellspacing=0 cellpadding=4 width=100%>		
				<tr>
					<td>Tindaklanjut</td>
					<td>:</td>
					<td>
					<textarea name="tindaklanjut" rows=2 cols=75></textarea>
					</td>
				</tr>
	
			</table>
			<br>
			<input type="submit" value="Simpan"> 
			<input type="button" value="Batal" onClick="window.location.href='detil_sm.php?id=<?php echo $kd_sm; ?>'">
			</form>
						
			</div>
        </div>
	</div>
</div>
<?php
	include_once "footer.php";
?>

<script type="text/javascript">
	$(function() { 
	$("#tgl").datepicker({dateFormat: "yy-mm-dd",
											buttonImage:'../jquery/css/images/calendar.gif',
											buttonImageOnly: true,
											showOn: 'button'
	}); 
	});
</script>

